import request from '../utils/request';

//获取用户信息
export const fetchData = () => {
    return request({
		url: 'http://192.168.5.3:9091/api/getUserNoParam',
       // url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/getUserNoParam',
        method: 'get',
       // params: query
    });
};

//根据查询获取用户信息
export const fetchDataPOST = query => {
    return request({
		//url:'./table.json',
        //url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/getUser',
		url:'http://192.168.5.3:9091/api/getUser',
        method: 'post',
        data: query
    });
};


//登陆验证
export const Logintest = info => {
    return request({
		url:'http://192.168.5.3:9091/api/login',
        //url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/login',
        method: 'post',
        data: info
    });
};

//注册验证
export const registerinfo = info => {
    return request({
		url:'http://192.168.5.3:9091/api/register',
        //url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/register',
        method: 'post',
        data: info
    });
};

//密码修改
export const changepw = info => {
    return request({
		url:'http://192.168.5.3:9091/api/forgetPassword',
       // url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/updatePassword',
        method: 'post',
        data: info,
    });
};

//------------------------------------------------------------------------------------------
//获取设备信息
export const getDeviceState = () => {
    return request({
		url:'http://192.168.5.3:9091/api/getDeviceState',
       // url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/getDeviceState',
        method: 'get',
    });
};
//图表请求三项数据
export const gettemhum =() => {
    return request({
	//	url:'http://192.168.5.3:9091/api/getsinTHIMrealtime',
	//	url:'http://127.0.0.1:4523/m1/2888201-0-default/api/getTempHudRealTime',//api三组数据传输
	//	url: 'http://192.168.5.3:9091/api/tempNumber',//后端接口一次传一个温度
		url: 'http://192.168.5.3:9091/api/getTempHudRealTime',//后端一次传三组数据
		//url:'http://192.168.5.3:9091/api/getTemp',
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/getsinTHIMrealtime',
    //   url:'http://127.0.0.1:4523/m1/2888201-0-default/api/getTemp',//可视化api一次传一个值和时间
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/tempNumber',//api接口一次传一个温度
        method: 'get',
    });
};

//图表请求历史数据
export const getthmhistory =() => {
    return request({
		url: 'http://192.168.5.3:9091/api/getTempHubHistory',
    //    url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/getTempHubHistory',
        method: 'get',
		//params:{},
	//	responseType:"blob",
    });
};

//按照时间请求历史数据区间
export const gethisSection =value => {
    return request({
		//url: 'http://127.0.0.1:4523/m1/2888201-0-default/api/getHistorySection',
  		url: 'http://192.168.5.3:9091/api/getHistorySection',
        method: 'post',
		data:value,
    });
};



//平均值请求
export const getaverage =() => {
    return request({
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/getAve',
		url:'http://192.168.5.3:9091/api/getAve',
        method: 'get',
    });
};



//删除数据
// export const deleteHistory =(info) => {
//     return request({
// 		url:'http://127.0.0.1:4523/m1/2888201-0-default/api/deleteMsg',
// 		//url:'http://192.168.5.3:9091/api/deleteMsg',
//         method: 'post',
// 		data:info,
//     });
// };

//删除用户
// export const deleteUser =(info) => {
//     return request({
// 		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/deleteUser',
// 		url:'http://192.168.5.3:9091/api/deleteUser',
//         method: 'post',
// 		data:info,
//     });
// };

export const gettempnext =() => {
    return request({
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/estimationTemp',
		url:'http://192.168.5.3:9091/api/estimationTemp',
        method: 'get',
    });
};

export const getmoisnext =() => {
    return request({
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/estimationMoisture',
		url:'http://192.168.5.3:9091/api/estimationMoisture',
        method: 'get',
    });
};


export const gethumnext =() => {
    return request({
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/estimationHum',
		url:'http://192.168.5.3:9091/api/estimationHum',
        method: 'get',
    });
};

export const getintnext =() => {
    return request({
		//url:'http://127.0.0.1:4523/m1/2888201-0-default/api/estimationIntensity',
		url:'http://192.168.5.3:9091/api/estimationIntensity',
        method: 'get',
    });
};